package org.utils
{
	import flash.display.DisplayObject;

	public class ImgControl
	{
		public function ImgControl()
		{
		}
		
		public static function autosize(obj:DisplayObject,matchObj:DisplayObject){
		
			var min:Number = Math.min(matchObj.width/obj.width,matchObj.height/obj.height)
			if (min < 1)obj.scaleX = obj.scaleY = min
			matchObj.addChild(obj)
			obj.x = (matchObj.width - obj.width)/2
			obj.y = (matchObj.height - obj.height)/2
		
		}
	}
}